﻿

using Minotaur.App.Domains.Model.Organization;
using Minotaur.App.Domains.Model.Position;
using Minotaur.App.Domains.Model.Role;
using SqlSugar;

namespace Minotaur.App.Domains.Model.Personal
{
    [SugarTable("Employee")]
    public class Employee : EntityBase
    {
        /// <summary>
        /// 员工ID
        /// </summary>
        [Key]
        [SugarColumn(ColumnName = "autoid", IsIdentity = true, IsPrimaryKey = true)]
        public virtual int AutoId { get; set; }
        /// <summary>
        /// 员工编码
        /// </summary>
        [SugarColumn(ColumnName = "empcode")]
        public virtual string? EmpCode { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        [SugarColumn(ColumnName = "email")]
        public virtual string? Email { get; set; }
        /// <summary>
        /// 手机
        /// </summary>
        [SugarColumn(ColumnName = "phone")]
        public virtual string? Phone { get; set; }

        /// <summary>
        /// 组织ID
        /// </summary>
        [SugarColumn(ColumnName = "orgid")]
        public virtual long? OrgId { get; set; }

        /// <summary>
        /// 职位ID
        /// </summary>

        [SugarColumn(ColumnName = "positionid")]
        public virtual long? PositionId { get; set; }

        /// <summary>
        /// 单位ID
        /// </summary>
        [SugarColumn(ColumnName = "unitid")]
        public virtual long? UnitId { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [SugarColumn(ColumnName = "gender")]
        public virtual string? Gender { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        [SugarColumn(ColumnName = "age")]
        public virtual int? Age { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [SugarColumn(ColumnName = "idcard")]
        public virtual string? IdCard { get; set; }

        /// <summary>
        /// 状态,0-删除，1-在职 ，2-离职，3-停职
        /// </summary>
        [SugarColumn(ColumnName = "status")]
        public virtual int Status { get; set; }

        /// <summary>
        /// 汇报人
        /// </summary>
        [SugarColumn(ColumnName = "repoter")]
        public virtual int Repoter { get; set; }

        [SugarColumn(ColumnName = "birthday")]
        public virtual DateTime? BirthDay { get; set; }

        [SugarColumn(ColumnName = "joindate")]
        public virtual DateTime? JoinDate { get; set; }

        [SugarColumn(ColumnName = "address")]
        public virtual string? Address { get; set; }
        /// <summary>
        /// 启用？
        /// </summary>
        [SugarColumn(ColumnName = "enable")]
        public virtual bool? Enable { get; set; }
        /// <summary>
        /// 顺序
        /// </summary>
        [SugarColumn(ColumnName = "sequence")]
        public virtual long? Sequence { get; set; }
        [SugarColumn(ColumnName = "havedelete")]
        public virtual bool HaveDelete { get; set; }
        [SugarColumn(ColumnName = "instanceid")]
        public virtual long? InstanceId { get; set; }

        /// <summary>
        /// 资源
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(EmployeeRes.EmpId))]
        public virtual List<EmployeeRes> Res { get; set; }

        /// <summary>
        /// 职位
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(PositionId), nameof(Position.Position.AutoId))]
        public virtual Position.Position Pos { get; set; }
        /// <summary>
        /// 职位
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(OrgId), nameof(Organization.Organization.AutoId))]
        public virtual Organization.Organization Org { get; set; }

        /// <summary>
        /// 角色
        /// </summary>
        [Navigate(typeof(RoleEmployeeInfo), nameof(RoleEmployeeInfo.EmpId), nameof(RoleEmployeeInfo.RoleId))]//注意顺序
        public virtual List<RoleInfo> Roles { get; set; }

    }
}
